
const pxtorem = require('postcss-pxtorem')
const autoprefixer = require('autoprefixer')
export default {
  /*
  ** Nuxt rendering mode
  ** See https://nuxtjs.org/api/configuration-mode
  */
  mode: 'universal',
  /*
  ** Nuxt target
  ** See https://nuxtjs.org/api/configuration-target
  */
  target: 'server',
  /*
  ** Headers of the page
  ** See https://nuxtjs.org/api/configuration-head
  */
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  /*
  ** Global CSS
  */
  css: [
    'element-ui/lib/theme-chalk/index.css',
    { src: '@/assets/css/index.scss', lang: 'scss' },
    '@/assets/icon/font_ay32768at7/iconfont.css',
    // 'assets/css/index.scss',
  ],
  /*
  ** Plugins to load before mounting the App
  ** https://nuxtjs.org/guide/plugins
  */
  plugins: [
    '@/plugins/element-ui',
    '@/plugins/axios',
    '@/plugins/session/index',
    '@/plugins/filter',
    '@/plugins/vue-cookies',
  ],
  /*
  ** Auto import components
  ** See https://nuxtjs.org/api/configuration-components
  */
  components: true,
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
  ],
  axios: {
    // baseURL: 'http://www.ys.com', // Used as fallback if no runtime config is provided
  },
  /*
  ** Axios module configuration
  ** See https://axios.nuxtjs.org/options
  */
  // axios: {
  //   proxy: true,
  //   prefix: '/',
  //   credentials: true
  // },
  // proxy: {
  //   '/': {
  //     target: 'http://www.ys.com',//这个网站是开源的可以请求到数据的
  //   }
  // },
  /*
  ** Build configuration
  ** See https://nuxtjs.org/api/configuration-build/
  */
  build: {
    transpile: [/^element-ui/],
    postcss: {
      plugins: [
        // pxtorem({
        //   // 配置px转换rem插件 https://github.com/cuth/postcss-pxtorem
        //   rootValue: 100,
        //   propList: ['*'],
        //   // selectorBlackList: [/^(?![\.|#]van-).*$/], // 忽略不是'.van-','#van-'开头的选择器，目的是只转换vant ui库里的，页面里的不需要
        //   selectorBlackList: [/^\.xmg-.*$/,/^html$/], // 忽略'.xmg-'开头的选择器
        //   minPixelValue: 2, // 最小像素值（小于这个像素不会被转换）
        // }),
        autoprefixer()  // 启用自动添加CSS浏览器兼容前缀，兼容浏览器列表在.browserslistrc文件
      ]
    }

  }
}
